package com.alks.function.controller.chengKong;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.*;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.chengKong.MatterRequest;
import com.alks.function.data.request.chengKong.YfMtlTypeDetailRequest;
import com.alks.function.service.chengKong.MaterialManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@ApiRestController("/MaterialManagement")
@Api(tags = "成控部-物料管理作业")
@Slf4j
public class MaterialManagementController {

    @Autowired
    private MaterialManagementService materialManagementService;

    @WebLogger
    @GetMapping("/getAssortList")
    @ApiOperation("分类资料定义列表")
    public ResponseInfo getAssortList(){
        return ResponseInfo.ok(materialManagementService.getAssortList());
    }

    @WebLogger
    @PostMapping("/getAssortAdd")
    @ApiOperation("分类资料定义添加")
    public ResponseInfo getAssortAdd(@RequestBody YfMtlTypeNew mtlTypeNew){
        return materialManagementService.getAssortAdd(mtlTypeNew);
    }

    @WebLogger
    @PostMapping("/getAssortDel")
    @ApiOperation("分类资料定义删除")
    public ResponseInfo getAssortDel(@RequestParam("typeNo") String typeNo){
        return materialManagementService.getAssortDel(typeNo);
    }

    @WebLogger
    @GetMapping("/getAssortByTypeNo")
    @ApiOperation("分类资料定义查询")
    public ResponseInfo getAssortByTypeNo(@RequestParam(value = "typeNo") String typeNo){
        return materialManagementService.getAssortByTypeNo(typeNo);
    }

    @WebLogger
    @PutMapping("/getAssortUpdate")
    @ApiOperation("分类资料定义修改")
    public ResponseInfo getAssortUpdate(@RequestBody YfMtlTypeNew yfMtlTypeNew){
        return materialManagementService.getAssortUpdate(yfMtlTypeNew);
    }

    @WebLogger
    @GetMapping("/getAssortUMoveUp")
    @ApiOperation("分类资料定义上移")
    public ResponseInfo getAssortUMoveUp(@RequestParam String typeNo) {
        return materialManagementService.getAssortUMoveUp(typeNo);
    }

    @WebLogger
    @GetMapping("/getAssortUMoveDown")
    @ApiOperation("分类资料定义下移")
    public ResponseInfo getAssortUMoveDown(@RequestParam String typeNo) {
        return materialManagementService.getAssortUMoveDown(typeNo);
    }

    @WebLogger
    @GetMapping("/getMaterialPropertiesList")
    @ApiOperation("物料属性定义-材料属性定义列表")
    public ResponseInfo getMaterialPropertiesList(){
        return materialManagementService.getMaterialPropertiesList();
    }

    @WebLogger
    @PostMapping("/getMaterialPropertiesAdd")
    @ApiOperation("物料属性定义-材料属性定义添加")
    public ResponseInfo getMaterialPropertiesAdd(@RequestBody YfMtlProperty yfMtlProperty){
        return materialManagementService.getMaterialPropertiesAdd(yfMtlProperty);
    }

    @WebLogger
    @GetMapping("/getMaterialPropertiesDel")
    @ApiOperation("物料属性定义-材料属性定义删除")
    public ResponseInfo getMaterialPropertiesDel(@RequestParam String mtlProperty){
        return materialManagementService.getMaterialPropertiesDel(mtlProperty);
    }

    @WebLogger
    @GetMapping("/getMaterialPropertiesSpecsList")
    @ApiOperation("物料属性定义-材料属性关联规格列表")
    public ResponseInfo getMaterialPropertiesSpecsList(@RequestParam String mtlProperty){
        return materialManagementService.getMaterialPropertiesSpecsList(mtlProperty);
    }

    @WebLogger
    @PostMapping("/getMaterialPropertiesSpecAdd")
    @ApiOperation("物料属性定义-材料属性关联规格添加")
    public ResponseInfo getMaterialPropertiesSpecAdd(@RequestBody YfMtlPropertyDetail yfMtlPropertyDetail){
        return materialManagementService.getMaterialPropertiesSpecAdd(yfMtlPropertyDetail);
    }

    @WebLogger
    @PutMapping("/getMaterialPropertiesSpecUpdate")
    @ApiOperation("物料属性定义-材料属性关联规格修改")
    public ResponseInfo getMaterialPropertiesSpecUpdate(@RequestBody YfMtlPropertyDetail detail){
        return materialManagementService.getMaterialPropertiesSpecUpdate(detail);
    }

    @WebLogger
    @PostMapping("/getMaterialPropertiesSpecDel")
    @ApiOperation("物料属性定义-材料属性关联规格删除")
    public ResponseInfo getMaterialPropertiesSpecDel(@RequestParam String mtlProperty,@RequestParam String mtlSpec){
        return materialManagementService.getMaterialPropertiesSpecDel(mtlProperty,mtlSpec);
    }

    @WebLogger
    @GetMapping("/getWideDefinitionList")
    @ApiOperation("物料属性定义-宽幅定义列表")
    public ResponseInfo getWideDefinitionList(){
        return materialManagementService.getWideDefinitionList();
    }

    @WebLogger
    @PostMapping("/getWideDefinitionAdd")
    @ApiOperation("物料属性定义-宽幅定义添加")
    public ResponseInfo getWideDefinitionAdd(@RequestBody YfMtlSpec yfMtlSpec){
        return materialManagementService.getWideDefinitionAdd(yfMtlSpec);
    }

    @WebLogger
    @PutMapping("/getWideDefinitionUpdate")
    @ApiOperation("物料属性定义-宽幅定义修改")
    public ResponseInfo getWideDefinitionUpdate(@RequestBody YfMtlSpec yfMtlSpec){
        return materialManagementService.getWideDefinitionUpdate(yfMtlSpec);
    }

    @WebLogger
    @PostMapping("/getWideDefinitionDel")
    @ApiOperation("物料属性定义-宽幅定义删除")
    public ResponseInfo getWideDefinitionDel(@RequestParam String mtlUnit){
        return materialManagementService.getWideDefinitionDel(mtlUnit);
    }

    @WebLogger
    @GetMapping("/getUnitList")
    @ApiOperation("物料属性定义-单位定义列表")
    public ResponseInfo getUnitList(){
        return materialManagementService.getUnitList();
    }

    @WebLogger
    @PostMapping("/getUnitAdd")
    @ApiOperation("物料属性定义-单位定义添加")
    public ResponseInfo getUnitAdd(@RequestBody YfMtlUnit yfMtlUnit){
        return materialManagementService.getUnitAdd(yfMtlUnit);
    }

    @WebLogger
    @PutMapping("/getUnitUpdate")
    @ApiOperation("物料属性定义-单位定义修改")
    public ResponseInfo getUnitUpdate(@RequestBody YfMtlUnit yfMtlUnit){
        return materialManagementService.updateUnit(yfMtlUnit);
    }

    @WebLogger
    @PostMapping("/getUnitDel")
    @ApiOperation("物料属性定义-单位定义删除")
    public ResponseInfo getUnitDel(@RequestParam String mtlUnit){
        return materialManagementService.getUnitDel(mtlUnit);
    }

    @WebLogger
    @GetMapping("/getFitList")
    @ApiOperation("物料属性定义-贴合加工方式定义列表")
    public ResponseInfo getFitList(){
        return materialManagementService.getFitList();
    }

    @WebLogger
    @PostMapping("/getFitAdd")
    @ApiOperation("物料属性定义-贴合加工方式定义添加")
    public ResponseInfo getFitAdd(@RequestBody YfMtlPrdType yfMtlPrdType){
        return materialManagementService.getFitAdd(yfMtlPrdType);
    }

    @WebLogger
    @PutMapping("/getFitUpdate")
    @ApiOperation("物料属性定义-贴合加工方式定义修改")
    public ResponseInfo getFitUpdate(@RequestBody YfMtlPrdType yfMtlPrdType){
        return materialManagementService.getFitUpdate(yfMtlPrdType);
    }

    @WebLogger
    @PostMapping("/getFitDel")
    @ApiOperation("物料属性定义-贴合加工方式定义删除")
    public ResponseInfo getFitDel(@RequestParam String prdType){
        return materialManagementService.getFitDel(prdType);
    }

    @WebLogger
    @PostMapping("/getTypeDetail")
    @ApiOperation("物料属性定义-分类建档列表")
    public ResponseInfo getTypeDetail(@RequestBody MatterRequest request){
        return materialManagementService.getTypeDetail(request);
    }

    @WebLogger
    @PostMapping("/getTypeDetailAdd")
    @ApiOperation("物料属性定义-分类建档添加")
    public ResponseInfo getTypeDetailAdd(@RequestBody YfMtlTypeDetail yfMtlTypeDetail){
        return materialManagementService.getTypeDetailAdd(yfMtlTypeDetail);
    }

    @WebLogger
    @PutMapping("/getTypeDetailUpdate")
    @ApiOperation("物料属性定义-分类建档修改")
    public ResponseInfo getTypeDetailUpdate(@RequestBody Map<String, YfMtlTypeDetailRequest> request){
        return materialManagementService.getTypeDetailUpdate(request);
    }

    @WebLogger
    @PostMapping("/getTypeDetailDel")
    @ApiOperation("物料属性定义-分类建档删除")
    public ResponseInfo getTypeDetailDel(@RequestBody YfMtlTypeDetailRequest request){
        return materialManagementService.getTypeDetailDel(request);
    }
}
